<%@page import="model.environment.*"%>
<%@page import="model.*"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<% 	PageViewInfo pvi = new PageViewInfo(); 
	pvi.setPageTitle("Front page"); %>
<%@include file="parts/header.jsp" %>
	<div class="content">
		<div style="position:relative">
            <div id="slider">
                <ul>
                	<% 
                	List<Item> featItems = new ArrayList<Item>();
                	int count = 0;
                	if (Login.isLoggedIn(session)) {
                		List<Integer> IDs = Datamining.getItemsMostLikelyBoughtBy(Login.getLoginID(session),4);
                		for(Integer i: IDs){
                			Item it = Items.getItem(i);
                			featItems.add(it);
                		}
                	} else {
                		List<Integer> IDs = Datamining.getItemsInMostSoldOrder();
                		for(Integer i: IDs){
                			Item it = Items.getItem(i);
                			featItems.add(it);
                		}
                	}
                	
                	for (Item i : featItems) 
                	{
                		if(count++ == 4){break;}
                		%>
                    <li>
                        <div class="img-hover">
                            <a href="showItem.jsp?itemID=<%= i.getItemID() %>">
                                <span class="img-hover-box"><%= i.getItemDescription() %></span>
                                <img width="700" src="<%= i.getFeaturedImageURL() %>" alt="<%= i.getItemName() %>"/>
                            </a>
                        </div>
                    </li>
                    <% } %>
                </ul>
            </div> 
        </div>
 	</div>
<%@include file="parts/footer.jsp" %>